<template>
  <!-- 寒暑假宿舍管理 -->
  <div class="app-container">
    <!-- 搜索 -->
      <searchForm
      :formOptions="formOptions"
      @onSearch="onSearch"
      @onReset="onReset"
      v-show="showSearch"
      :formLabelWidth="formLabelWidth"
    />
    <el-row :gutter="10" class="mb8">
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>
    <el-table :data="tableData">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column prop="name" label="学号"> </el-table-column>
      <el-table-column prop="name" label="姓名"> </el-table-column>
      <el-table-column prop="name" label="性别"> </el-table-column>
      <el-table-column prop="name" label="电话"> </el-table-column>X
      <el-table-column prop="name" label="身份证号码"> </el-table-column>
      <el-table-column prop="name" label="所在院部"> </el-table-column>
      <el-table-column prop="name" label="专业"> </el-table-column>
      <el-table-column prop="name" label="班级"> </el-table-column>
      <el-table-column prop="name" label="年级"> </el-table-column>
      <el-table-column prop="name" label="学生类型"> </el-table-column>
      <el-table-column prop="name" label="楼号"> </el-table-column>
      <!-- <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="">
          <el-button size="mini" type="text" icon="el-icon-edit"
            >审批流程详情</el-button
          >
        </template>
      </el-table-column> -->
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import searchForm from "../../components/Search/searchForm.vue";
export default {
  components: { searchForm },
  data() {
    return {
      formLabelWidth:"80px",
      formOptions: [
        {
          label: "楼号",
          prop: "LH",
          element: "el-input",
          placeholder: "请输入楼号",
        },
        {
          label: "层号",
          prop: "CH",
          element: "el-input",
          placeholder: "请输入层号",
        },
        {
          label: "房间号",
          prop: "FJH",
          element: "el-input",
          placeholder: "请输入房间号",
        },
        {
          label: "院系",
          prop: "YX",
          element: "el-input",
          placeholder: "请输入院系",
        },
        {
          label: "专业",
          prop: "ZY",
          element: "el-input",
          placeholder: "请输入专业",
        },
        {
          label: "班级",
          prop: "ZY",
          element: "el-input",
          placeholder: "请输入班级",
        },
        {
          label: "年级",
          prop: "NJ",
          element: "el-input",
          placeholder: "请输入年级",
        },
        {
          label: "留校类型",
          prop: "type",
          element: "el-select",
          options: [
            { label: "给点意见", value: "1" },
            { label: "售后问题", value: "2" },
          ],
          placeholder: "请选择留校类型",
        },
      ],
      showSearch:true,
      tableData: [],
      total: 0,
      formLabelWidth: "70px",
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        roleName: undefined,
        roleKey: undefined,
        status: undefined,
        CH: undefined,
        FJH: undefined,
        LH: undefined,
        XH: undefined,
      },
    };
  },
  methods: {
    // 获取搜索表单提交的数据
    onSearch(val) {
      // 查询条件和分页数据合并
      const arr = Object.assign(this.queryParams, val);
      console.log(arr);
      this.queryParams.pageNum = 1;
      this.getList();
    },
      // 重置
      onReset(data) {
      console.log(data);
      this.queryParams.pageNum = 1;
      const arr = Object.assign(this.queryParams, data);
      console.log(this.queryParams);
      this.getList();
    },
    /** 查询角色列表 */
    getList() {
      this.loading = true;
      listRole(this.addDateRange(this.queryParams, this.dateRange)).then(
        (response) => {
          this.tableData = response.rows;
          this.total = response.total;
        }
      );
    },
  },
};
</script>

<style>
</style>